<%-- 
    Document   : halamanTambahPengmas
    Created on : Oct 11, 2012, 1:23:27 PM
    Author     : user
--%>

<%@include file="../header.jsp"%>

<link href="css/datePicker.css" type="text/css" rel="stylesheet" />
<script type="text/javascript" src="js/jquery/jquery.datePicker.js"></script>
<script type="text/javascript">
    $(function()
    {
        $('#tanggalMulai').datePicker({
        });
        $('#tanggalSelesai').datePicker({
        });
    });
</script>

<!-- end page-heading //sampai sini-->

<div class="clear"></div>

<!-- start content-outer -->
<div id="content-outer">
    <!-- start content -->
    <div id="content">


        <div id="page-heading"><h1>Tambah Pengabdian Masyarakat</h1></div>


        <table border="0" width="100%" cellpadding="0" cellspacing="0" id="content-table">
            <tr>
                <th rowspan="3" class="sized"><img src="images/shared/side_shadowleft.jpg" width="20" height="300" alt="" /></th>
                <th class="topleft"></th>
                <td id="tbl-border-top">&nbsp;</td>
                <th class="topright"></th>
                <th rowspan="3" class="sized"><img src="images/shared/side_shadowright.jpg" width="20" height="300" alt="" /></th>
            </tr>
            <tr>
                <td id="tbl-border-left"></td>
                <td>
                    <!--  start content-table-inner -->
                    <div id="content-table-inner">

                        <table border="0" width="100%" cellpadding="0" cellspacing="0">
                            <tr valign="top">
                                <td>
                                    <script>
                                        function validateForm()
                                        {                                            
                                            
                                            var a = document.getElementById('tanggalMulai');
                                            
                                            var b = document.getElementById('tanggalSelesai');

                                            var first = a.value;

                                            var second = b.value;

                                            var firstDate = new Date(first.split('-')[0],first.split('-')[1],first.split('-')[2]);

                                            var secondDate = new Date(second.split('-')[0],second.split('-')[1],second.split('-')[2]);

                                            var Difference = firstDate.getDate() - secondDate.getDate();
                                            
                                            var judul = true, ketuaPeneliti= true, danaDiterima= true, programPendanaan= true, tanggal= true, anggotaDosen= true, anggotaMhs= true, lap = true;
                                                                                                
                                            if(document.frm.ketuaPeneliti.value=="")
                                            {                                                
                                                document.getElementById("ketuaPeneliti_error").innerHTML="<div class='error-left'></div><div class='error-inner'>Ketua Pengabdian Masyarakat Belum Dipilih.</div>";
                                                ketuaPeneliti= false;
                                            } else {
                                                document.getElementById("ketuaPeneliti_error").innerHTML="";
                                            }
                                            
                                            if(document.frm.judul.value=="")
                                            {                                                
                                                document.getElementById("judul_error").innerHTML="<div class='error-left'></div><div class='error-inner'>Judul Pengabdian Masyarakat Belum Terisi.</div>";
                                                judul = false;
                                            } else {
                                                document.getElementById("judul_error").innerHTML="";       
                                            }                                              
                                            
                                            if(document.frm.danaDiterima.value=="")
                                            {
                                                document.getElementById("danaDiterima_error").innerHTML="<div class='error-left'></div><div class='error-inner'>Jumlah Dana yang Diterima Belum Diisikan.</div>";
                                                danaDiterima= false;
                                            } else {
                                                document.getElementById("danaDiterima_error").innerHTML="";
                                            }    
                                            
                                            if(document.frm.programPendanaan.value=="")
                                            {
                                                document.getElementById("programPendanaan_error").innerHTML="<div class='error-left'></div><div class='error-inner'>Program Pendanaan Belum Dipilih.</div>";
                                                programPendanaan= false;
                                            } else {
                                                document.getElementById("programPendanaan_error").innerHTML="";
                                            }
                                            
                                            if (document.frm.tanggalMulai.value==""){
                                                document.getElementById("tanggal_error").innerHTML="<div class='error-left'></div><div class='error-inner'>Tanggal pelaksanaan belum diisi.</div>";
                                                tanggal = false;
                                            } else if(document.frm.tanggalSelesai.value==""){
                                                document.getElementById("tanggal_error").innerHTML="<div class='error-left'></div><div class='error-inner'>Tanggal berakhirnya belum diisi.</div>";
                                                tanggal = false;
                                            } else if (firstDate.getFullYear() > secondDate.getFullYear()){
                                                document.getElementById("tanggal_error").innerHTML="<div class='error-left'></div><div class='error-inner'>Periksa lagi periode pelaksanaan.</div>";
                                                tanggal = false;
                                            } else {
                                                if(firstDate.getFullYear() == secondDate.getFullYear() && firstDate.getMonth() > secondDate.getMonth()){
                                                    document.getElementById("tanggal_error").innerHTML="<div class='error-left'></div><div class='error-inner'>Periksa lagi periode pelaksanaan.</div>";
                                                    tanggal = false;
                                                }else{
                                                    if(firstDate.getMonth() == secondDate.getMonth() && firstDate.getDate() > secondDate.getDate()){
                                                        document.getElementById("tanggal_error").innerHTML="<div class='error-left'></div><div class='error-inner'>Periksa lagi periode pelaksanaan.</div>";
                                                        tanggal = false;
                                                    }else{
                                                        document.getElementById("tanggal_error").innerHTML="";
                                                    }                                                    
                                                }
                                                
                                            }
                                            
                                            if(document.frm.anggotaDosen.value=="")
                                            {
                                                document.getElementById("anggotaDosen_error").innerHTML="<div class='error-left'></div><div class='error-inner'>Jumlah Anggota Dosen Belum Diisikan.</div>";
                                                anggotaDosen= false;
                                            } else if(!document.frm.anggotaDosen.value.match(/^[0-9]+$/)) {
                                                document.getElementById("anggotaDosen_error").innerHTML="<div class='error-left'></div><div class='error-inner'>Data yang diisikan bukan angka.</div>";
                                                anggotaDosen= false;                                              
                                            }else {
                                                document.getElementById("anggotaDosen_error").innerHTML="";
                                            }
                                            
                                            if(document.frm.anggotaEks.value=="")
                                            {
                                                document.getElementById("anggotaEks_error").innerHTML="<div class='error-left'></div><div class='error-inner'>Jumlah Anggota Peneliti Eksternal Belum Diisikan.</div>";
                                                anggotaEks= false;
                                            } else if(!document.frm.anggotaEks.value.match(/^[0-9]+$/)) {
                                                document.getElementById("anggotaEks_error").innerHTML="<div class='error-left'></div><div class='error-inner'>Data yang diisikan bukan angka.</div>";
                                                anggotaEks= false;                                              
                                            }else {
                                                document.getElementById("anggotaEks_error").innerHTML="";
                                            } 
                                            
                                            if(document.frm.anggotaMhs.value=="")
                                            {
                                                document.getElementById("anggotaMhs_error").innerHTML="<div class='error-left'></div><div class='error-inner'>Jumlah Anggota Mahasiswa Belum Diisikan.</div>";
                                                anggotaMhs= false;
                                            } else if(!document.frm.anggotaMhs.value.match(/^[0-9]+$/)) {
                                                document.getElementById("anggotaMhs_error").innerHTML="<div class='error-left'></div><div class='error-inner'>Data yang diisikan bukan angka.</div>";
                                                anggotaMhs= false;                                              
                                            }else {
                                                document.getElementById("anggotaMhs_error").innerHTML="";
                                            } 
                                            
                                            if(document.frm.lap.value==""){
                                                document.getElementById("lap_error").innerHTML="<div class='error-left'></div><div class='error-inner'>File Laporan Penelitian Belum Dipilih.</div>";
                                                lap= false;                                                
                                            } else if(document.frm.lap.value!="")
                                            {
                                                if(!/(\.doc|\.pdf|\.xls|\.docx|\.xlsx)$/i.test(document.frm.lap.value))
                                                {
                                                    document.getElementById("lap_error").innerHTML="<div class='error-left'></div><div class='error-inner'>Format File Tidak Diperbolehkan.</div>";
                                                    lap= false;
                                                }
                                                
                                            } else {
                                                document.getElementById("lap_error").innerHTML="";
                                            }
                                            
                                            if(judul && ketuaPeneliti && danaDiterima && programPendanaan && tanggal && anggotaDosen && anggotaMhs && lap){
                                                return true;
                                            }else{
                                                return false;
                                            }
        
                                        }
                                    </script>
                                    <!--  start step-holder -->
                                    <div id="step-holder">
                                        <div class="step-no">1</div>
                                        <div class="step-dark-left"><a href="">Data Pengmas</a></div>
                                        <div class="step-dark-right">&nbsp;</div>
                                        <div class="step-no-off">2</div>
                                        <div class="step-light-left">Data Dosen</div>
                                        <div class="step-light-right">&nbsp;</div>
                                        <div class="step-no-off">3</div>
                                        <div class="step-light-left">Data Mahasiswa</div>
                                        <div class="step-light-round">&nbsp;</div>
                                        <div class="clear"></div>
                                    </div>
                                    <!--  end step-holder -->
                                    <!-- start id-form -->
                                    <form id="postform" name="frm" method="post" action="tambahLaporanPengmas?status=submitData" enctype="multipart/form-data" onsubmit="return validateForm()">
                                        <table border="0" cellpadding="5" cellspacing="15"  id="id-form">

                                            <tr>
                                                <th width="280" valign="top">Judul Pengabdian Masyarakat *</th>
                                                <td width="15">:</td>
                                                <td><textarea name="judul" class="form-textarea" id="judul"></textarea></td>
                                                <td id="judul_error"></td>
                                            </tr>
                                            <tr>
                                                <th valign="top">Ketua Tim Pengabdian Masyarakat *</th>
                                                <td width="15">:</td>
                                                <td>
                                                    <select name="ketuaPeneliti" id="ketuaPeneliti" class="styledselect_form_1">
                                                        <option value="">- Pilih Ketua Peneliti -</option>
                                                        <c:forEach items="${dosen}" var="dosen">
                                                            <option value="${dosen.user.idUser}"
                                                                    <c:if test="${(dosen.user.idUser == nipDosen)}">                
                                                                        selected="selected"
                                                                    </c:if>
                                                                    >${dosen.user.namaUser}</option>
                                                        </c:forEach>
                                                    </select>
                                                </td>
                                                <td id="ketuaPeneliti_error"></td>
                                            </tr>
                                            <tr>
                                                <th valign="top">Dana yang Diterima *</th>
                                                <td width="15">:</td>
                                                <td><input type="text" name="danaDiterima" id="danaDiterima" class="inp-form" onKeyup="ri32()"/>                                                
                                                </td>
                                                <td id="danaDiterima_error">
                                                    <div class="bubble-left"></div>
                                                    <div class="bubble-inner">Diisi Tanpa Menggunakan Tanda Titik.</div>
                                                    <div class="bubble-right"></div>
                                                </td>
                                            </tr>
                                            <tr>
                                                <th valign="top">Sumber Pendanaan *</th>
                                                <td width="15">:</td>
                                                <td>
                                                    <select name="programPendanaan" id="programPendanaan" class="styledselect_form_1">
                                                        <option value="">- Pilih Sumber Pendanaan -</option>
                                                        <c:forEach items="${dana}" var="dana">
                                                            <option value="${dana.idSumberPendanaan}"
                                                                    <c:if test="${(dana.idSumberPendanaan == idSumberPendanaan)}">                
                                                                        selected="selected"
                                                                    </c:if>
                                                                    >${dana.sumberPendanaan}</option>
                                                        </c:forEach>
                                                    </select>
                                                </td>
                                                <td id="programPendanaan_error"> </div>
                                                </td>
                                            </tr>
                                            <tr>
                                                <th valign="top">Tanggal Pelaksanaan *</th>
                                                <td width="15">:</td>
                                                <td valign="center">
                                                    <input type="text" name="tanggalMulai" class="inp-form" id="tanggalMulai" READONLY/> s.d. 
                                                    <input type="text" name="tanggalSelesai" class="inp-form" id="tanggalSelesai" READONLY/>
                                                </td>
                                                <td id="tanggal_error"></td>
                                            </tr>
                                            <tr>
                                                <th valign="top">Jumlah Anggota (Dosen) *</th>
                                                <td width="15">:</td>
                                                <td><input type="text" name="anggotaDosen" id="anggotaDosen" class="inp-form"/>                                                
                                                </td>
                                                <td id="anggotaDosen_error">
                                                    <div class="bubble-left"></div>
                                                    <div class="bubble-inner">Isikan jumlah anggota dosen tanpa ketua penelitian.</div>
                                                    <div class="bubble-right"></div>
                                                </td>
                                            </tr>
                                            <tr>
                                                <th valign="top">Jumlah Pelaksana Eksternal <font color="red">*</font></th>
                                                <td width="15">:</td>
                                                <td><input type="text" name="anggotaEks" id="anggotaEks" class="inp-form"/>                                                
                                                </td>
                                                <td id="anggotaEks_error"></td>
                                            </tr>
                                            <tr>
                                                <th valign="top">Jumlah Anggota (Mahasiswa) *</th>
                                                <td width="15">:</td>
                                                <td><input type="text" name="anggotaMhs" id="anggotaMhs" class="inp-form"/>                                                
                                                </td>
                                                <td id="anggotaMhs_error"></td>
                                            </tr>
                                            <tr>
                                                <th valign="top">Laporan Pengabdian Masyarakat *</th>
                                                <td width="15">:</td>
                                                <td><input type="file" name="lap" id="lap" class="file_1"></td>
                                                <td id="lap_error">
                                                    <div class="bubble-left"></div>
                                                    <div class="bubble-inner">Upload Dokumen Dalam Bentuk pdf atau word.</div>
                                                    <div class="bubble-right"></div>                                                    
                                                </td>
                                            </tr>
                                            <tr>
                                                <th>&nbsp;</th>
                                                <td></td>
                                                <td valign="top">
                                                    <input type="submit" value="" class="form-lanjutkan" />
                                                    <a href="tambahLaporanPengmas?status=batal"><input type="button" value="" class="form-batal"  /></a>
                                                </td>
                                                <td></td>
                                            </tr>

                                        </table>
                                    </form>
                                    <!-- end id-form  -->

                                </td>

                                <td>

                                    <!--  start related-activities -->
                                    <div id="related-activities">

                                        <!--  start related-act-top -->
                                        <div id="related-act-top">
                                            <img src="images/forms/header_related_act.gif" width="271" height="43" alt="" />
                                        </div>
                                        <!-- end related-act-top -->

                                        <!--  start related-act-bottom -->
                                        <div id="related-act-bottom">

                                            <!--  start related-act-inner -->
                                            <div id="related-act-inner">

                                                <!--<div class="left"><a href=""><img src="images/forms/icon_plus.gif" width="21" height="21" alt="" /></a></div>-->
                                                <div class="right">
                                                    <h5>Pengisian Data </h5>
                                                    Silakan isi data dengan teliti dan benar. Kolom yang bertanda * wajib diisi.
                                                    <!--<ul class="greyarrow">
                                                        <li><a href="">Click here to visit</a></li> 
                                                        <li><a href="">Click here to visit</a> </li>
                                                    </ul>-->
                                                </div>

                                                <div class="clear"></div>
                                                <div class="lines-dotted-short"></div>

                                                <!--<div class="left"><a href=""><img src="images/forms/icon_minus.gif" width="21" height="21" alt="" /></a></div>-->

                                                <!--<div class="left"><a href=""><img src="images/forms/icon_edit.gif" width="21" height="21" alt="" /></a></div>-->
                                                <div class="right">
                                                    <h5>Upload Dokumen</h5>
                                                    Upload Dokumen Dalam Bentuk pdf atau word.
                                                    <!--<ul class="greyarrow">
                                                        <li><a href="">Click here to visit</a></li> 
                                                        <li><a href="">Click here to visit</a> </li>
                                                    </ul>-->
                                                </div>
                                                <div class="clear"></div>
                                                <div class="lines-dotted-short"></div>

                                                <div class="left"><a href=""><img src="images/forms/icon_plus.gif" width="21" height="21" alt="" /></a></div>
                                                <div class="right">
                                                    <h5><a href="tambahSumberPendanaan">Tambah Program Pendanaan</a></h5>
                                                    Silakan tambahkan program pendanaan jika belum terdapat di daftar program pendanaan.
                                                    <!--<ul class="greyarrow">
                                                        <li><a href="">Click here to visit</a></li> 
                                                        <li><a href="">Click here to visit</a> </li>
                                                    </ul>-->
                                                </div>
                                                <div class="clear"></div>
                                            </div>
                                            <!-- end related-act-inner -->
                                            <div class="clear"></div>

                                        </div>
                                        <!-- end related-act-bottom -->

                                    </div>
                                    <!-- end related-activities -->

                                </td>
                            </tr>
                            <tr>
                                <td><img src="images/shared/blank.gif" width="695" height="1" alt="blank" /></td>
                                <td></td>
                            </tr>
                        </table>

                        <div class="clear"></div>


                    </div>
                    <!--  end content-table-inner  -->
                </td>
                <td id="tbl-border-right"></td>
            </tr>
            <tr>
                <th class="sized bottomleft"></th>
                <td id="tbl-border-bottom">&nbsp;</td>
                <th class="sized bottomright"></th>
            </tr>
        </table>

        <div class="clear">&nbsp;</div>

    </div>
    <!--  end content -->
    <div class="clear">&nbsp;</div>
</div>
<!--  end content-outer -->



<div class="clear">&nbsp;</div>

<%@include file="../footer.jsp"%>
